import React from 'react';
import { IResourRangeState } from './useResourRangeReducer';

export interface IDictionaryContext extends IResourRangeState {
  // prefixCls: string;
  treeData: Record<string, any>[];
  resRangeDispatch: React.Dispatch<any>;
  reloadTableDataSource: (id: string) => void;
  treeLoading: boolean;
}

const INIT_RESOURrANGE_VALUE: IDictionaryContext = {
  // prefixCls: '',
  searchValue: '',
  treeData: [],
  selectKeys: [],
  expandedKeys: [],
  autoExpandParent: false,
  resRangeDispatch: () => {},
  reloadTableDataSource: () => {},
  expandedRowKeys: [],
  searchTableValue: '',
  treeLoading: false,
  checkedRowKeys: [], //表格选中的key
  checkTableRows: {},
};

export const ResourRangeContext = React.createContext<IDictionaryContext>(
  INIT_RESOURrANGE_VALUE,
);
